import { _decorator, Component, Node, tween, v3 } from 'cc';
import { _wheel } from '../../Main';
const { ccclass, property } = _decorator;

@ccclass('Trans')
export class Trans extends Component {
    
    @property([Node])
    lights: Node[] = []

    start() {
        let border: number = this.lights.length
        for (let i = 0; i < border; i++) {
            let r: number = _wheel.getRandomInt(0, this.lights.length)
            let light: Node = this.lights[r]
            this.lights.splice(r, 1)
            tween(light)
                .delay(.2 * i)
                .by(_wheel.getRandomInt(1, 3) * 0.5, { position: v3(2000, 0, 0) })
                .start()
        }
    }
}


